{% extends 'admin/banner.html' %}

{% block button %}{% endblock button %}


{% block table_content %}
    <form action="" method="post" class="mt-4" enctype="multipart/form-data">
        {{ form.csrf_token }}
        <div class="field">
            {{ form.img.label(class='label') }}
            <div class="control">
                <b-field class="file">
                    <b-upload v-model="file" name="img" expanded>
                      <a class="button is-primary is-fullwidth">
                        <b-icon icon="upload"></b-icon>
                        <span>{$ file.name || "{% if banner %}{{ banner.img }}{% else %}Click to upload{% endif %}" $}</span>
                      </a>
                    </b-upload>
                </b-field>
                <p class="help has-text-grey-light">
                    {{ form.img.description }}
                </p>
            </div>
        </div>
        <div class="field">
            {{ form.url.label(class='label') }}
            <div class="control">
                {{ form.url(class='input', placeholder='url') }}
                <p class="help has-text-grey-light">
                    {{ form.url.description }}
                </p>
            </div>
        </div>
        <div class="field">
            {{ form.desc.label(class='label') }}
            <div class="control">
                {{ form.desc(class='input',  placeholder='描述') }}
                <p class="help has-text-grey-light">
                    {{ form.desc.description }}
                </p>
            </div>
        </div>
        
        <div class="is-block">
            <div class="box has-background-light is-shadowless level">
                <button class=" is-danger button level-left">删除</button>
                <div class="level-right">
                    <a href="{{ url_for('admin.banner') }}" class="button is-primary is-light mr-2">返回</a>
                    <input type="submit" value="保存" class=" button is-success">
                </div>
            </div>
        </div>
    </form>
{% endblock table_content %}